package com.baizhi.controller;

import com.baizhi.entity.CmfzArticle;
import com.baizhi.lucenceservice.LucenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: renpu
 * @Date: 2019/3/13 22:21
 * @Description:
 */
@Controller

//模块名称；
@RequestMapping("/Lucence")
public class LucenceController {

    @Autowired
    private LucenceService lucenceService;

    @RequestMapping("/queryArticle")
    @ResponseBody
    public Map selectQuery(String keyWord){
        System.out.println("+++++++++++++++++++++++++++");
        System.out.println(keyWord);
        Map map=new HashMap();
        map.put("rows",lucenceService.queryByKeyWord(keyWord));
        System.out.println(map);
        return map;
    }

    @RequestMapping("/reload")
    public void reload(){
        lucenceService.resetIndex();
    }
}
